libxl: New convenience macro CONTAINER_OF
authorIan Jackson <ian.jackson@eu.citrix.com>
Fri, 27 Jan 2012 17:01:24 +0000 (17:01 +0000)
committerIan Jackson <ian.jackson@eu.citrix.com>
Fri, 27 Jan 2012 17:01:24 +0000 (17:01 +0000)
commit7632e94da4d73e72a75cbc2e09326b367cf96a22
treec480cd2697bc59de714bba6c0f5c26f594374149
parent889a89c7acd57fc21fb6900a685bb0b92c1162fe
libxl: New convenience macro CONTAINER_OF

Provide a convenient and type-safe wrapper which does the correct
dance to subtract offsetof.  This is very similar to the
"container_of" macro in the Linux kernel, but it has an additional
feature that instead of the type argument you may also pass an
expression of that type; this makes initialising a variable with
CONTAINER_OF easier.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
tools/libxl/libxl_internal.h